<template>
  <div class="audition146">
    <v-md-preview :text="text1" />
  </div>
</template>

<script>
const prefix = '``` js'
const suffix = '```'
export default {
  name: 'Audition146',
  data() {
    return {
      text1: `${prefix}
      const thousandSplitNum = num => {
        return num && num
          .toString()
          .replace(/(\d)(?=(\d{3})+(?!\d))/g, function ($0, $1) {
            return $1 + ","
          })
      }
      // 测试
      console.log(thousandSplitNum(1234567780)) // 1,234,567,780
      \n${suffix}`,
    }
  }
}
</script>

<style>

</style>